{#
This file is part of EC-CUBE

Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.

http://www.ec-cube.co.jp/

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#}

{% extends 'default_frame.twig' %}

{% set menus = ['setting', 'system', 'masterdata'] %}

{% block title %}システム設定{% endblock %}
{% block sub_title %}マスターデータ管理{% endblock %}

{% block main %}
<form id="form1" name="form1" method="post" action="{{ url('admin_setting_system_masterdata') }}">
<div class="row">
    {{ form_widget(form._token) }}
        <div id="master_edit" class="col-md-12">
            <div id="master_edit_box" class="box">
                <div id="master_edit_box__header" class="box-header">
                    <h3 class="box-title">マスターデータ管理</h3>
                </div><!-- /.box-header -->
                <div id="master_edit_box__body" class="box-body">
                    <div id="master_edit_box__body_inner" class="form-inline form-group">
                        <div id="master_edit_box__masterdata" class="form-group">
                            {{ form_widget(form.masterdata, {'attr': {'class': 'form-control'}}) }}
                            {{ form_errors(form.masterdata) }}
                        </div>
                        <div id="master_edit_box__confirm_button" class="form-group">
                            <button class="btn btn-primary btn-block" type="submit">選択</button>
                        </div>
                    </div>
                    <div class="extra-form clearfix">
                        {% for f in form.getIterator %}
                            {% if f.vars.name matches '[^plg*]' %}
                                <div class="form-group">
                                    {{ form_label(f) }}
                                    {{ form_widget(f) }}
                                    {{ form_errors(f) }}
                                </div>
                            {% endif %}
                        {% endfor %}
                    </div>
                </div><!-- /.box-body -->
            </div><!-- /.box -->
        </div>
    </div>
</form>

{% if form2.data is not empty %}
<div class="row" id="aside_wrap">
<form id="form2" name="form2" method="post" action="{{ url('admin_setting_system_masterdata_edit') }}">
    {{ form_widget(form2.masterdata_name) }}
    {{ form_widget(form2._token) }}
        <div id="result_list_box" class="col-md-9">
            <div id="result_list_box__body" class="box">
                <div id="result_list_box__header" class="box-header">
                    <div class="read">
                        マスターデータの値を設定できます。<br />
                        重複したIDを登録することはできません。<br />
                        空のIDを登録すると、値は削除されます。<br />
                        設定値によってはサイトが機能しなくなる場合もありますので、十分ご注意下さい。
                    </div>
                </div>

                <div id="result_list__body_inner" class="table-responsive">
                    <table id="result_list__list" class="table table-bordered table-striped">
                        <colgroup>
                            <col width="50%">
                            <col>
                        </colgroup>
                        <tr id="result_list__list_header">
                            <th id="result_list__header_id">ID</th>
                            <th id="result_list__header_name">Name</th>
                            {#<th>Rank</th>#}
                        </tr>
                        {% for data in form2.data %}
                        <tr id="result_list__item--{{ data.vars.name }}">
                            <td id="result_list__id--{{ data.vars.name }}">
                                {{form_widget(data.id)}}
                                {{form_errors(data.id)}}
                            </td>
                            <td id="result_list__name--{{ data.vars.name }}">
                                {{form_widget(data.name)}}
                                {{form_errors(data.name)}}
                            </td>
                            {#
                            <td id="result_list__rank">
                                {{form_widget(data.rank)}}
                            </td>
                            #}
                        </tr>
                        {% endfor %}
                    </table>
                </div>
            </div><!-- /.box-body -->
        </div>

        <div class="col-md-3" id="aside_column">
            <div id="common_box" class="col_inner">
                <div id="common_button_box" class="box no-header">
                    <div id="common_button_box__body" class="box-body">
                        <div id="common_button_box__insert_button"  class="row text-center">
                            <div class="col-sm-6 col-sm-offset-3 col-md-12 col-md-offset-0">
                                <button class="btn btn-primary btn-block btn-lg" type="submit">登録</button>
                            </div>
                        </div>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
            </div>
        </div><!-- /.col --> 
</form>
</div>
{% endif %}
{% endblock %}
